home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl70b2.lha / tcl7.0b2 / tests / unknown.test < prev    next >
Text File  |  1993-02-06  |  3KB  |  74 lines

  1. # Commands covered:  unknown
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # All rights reserved.
  9. #
  10. # Permission is hereby granted, without written agreement and without
  11. # license or royalty fees, to use, copy, modify, and distribute this
  12. # software and its documentation for any purpose, provided that the
  13. # above copyright notice and the following two paragraphs appear in
  14. # all copies of this software.
  15. #
  16. # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  17. # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  18. # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  19. # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. #
  21. # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  22. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  23. # AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  24. # ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  25. # PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  26. #
  27. # $Header: /user6/ouster/tcl/tests/RCS/unknown.test,v 1.5 93/02/06 16:01:39 ouster Exp $ (Berkeley)
  28.  
  29. if {[string compare test [info procs test]] == 1} then {source defs}
  30.  
  31. catch {rename unknown {}}
  32.  
  33. test unknown-1.1 {non-existent "unknown" command} {
  34.     list [catch {_non-existent_ foo bar} msg] $msg
  35. } {1 {invalid command name: "_non-existent_"}}
  36.  
  37. proc unknown {args} {
  38.     global x
  39.     set x $args
  40. }
  41.  
  42. test unknown-2.1 {calling "unknown" command} {
  43.     foobar x y z
  44.     set x
  45. } {foobar x y z}
  46. test unknown-2.2 {calling "unknown" command with lots of args} {
  47.     foobar 1 2 3 4 5 6 7
  48.     set x
  49. } {foobar 1 2 3 4 5 6 7}
  50. test unknown-2.3 {calling "unknown" command with lots of args} {
  51.     foobar 1 2 3 4 5 6 7 8
  52.     set x
  53. } {foobar 1 2 3 4 5 6 7 8}
  54. test unknown-2.4 {calling "unknown" command with lots of args} {
  55.     foobar 1 2 3 4 5 6 7 8 9
  56.     set x
  57. } {foobar 1 2 3 4 5 6 7 8 9}
  58.  
  59. test unknown-3.1 {argument quoting in calls to "unkown"} {
  60.     foobar \{ \} a\{b \; "\\" \$a a\[b \]
  61.     set x
  62. } "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
  63.  
  64. proc unknown args {
  65.     error "unknown failed"
  66. }
  67.  
  68. test unknown-4.1 {errors in "unknown" procedure} {
  69.     list [catch {non-existent a b} msg] $msg $errorCode
  70. } {1 {unknown failed} NONE}
  71.  
  72. catch {rename unknown {}}
  73. return {}
  74.